import weibo_console as wc
import weibo_write_data as wwd
import time



#_______________________________________________________________________________________________________________________
#@ 常量
DESKTOP     = r'C:\Users\lainiao\Desktop\\'
TXT         = '.txt'
XLSX        = '.xlsx'



#_______________________________________________________________________________________________________________________
#@ 昵称 —— UID（精准）（控制台）
def main_console_uid_by_nickname_and_exact():
    obj = wc.WEIBO_CONSOLE()
    obj.console_uid_by_nickname_and_exact()
#_______________________________________________________________________________________________________________________
#@ 昵称 —— UID（精准）
def main_write_uid_by_nickname_and_exact():
    #! 修改值（路径）
    path_read_txt       = DESKTOP + 'aa' + TXT      # 昵称
    path_write_excel    = DESKTOP + 'bb' + XLSX     # UID
    path_write_txt      = DESKTOP + 'cc' + TXT      # 无匹配昵称
    #// 爬虫
    obj = wwd.WEIBO_WRITE_DATA()
    obj.write_uid_by_nickname_and_exact(path_read_txt,path_write_excel,path_write_txt)
#_______________________________________________________________________________________________________________________
#@ 昵称 —— UID（模糊）
def main_write_uid_by_nickname_and_fuzzy():
    #! 修改值（路径）
    path_read_txt       = DESKTOP + 'aa' + TXT      # 昵称
    path_write_excel    = DESKTOP + 'bb' + XLSX     # UID
    path_write_txt      = DESKTOP + 'cc' + TXT      # 无匹配昵称
    #// 爬虫
    obj = wwd.WEIBO_WRITE_DATA()
    obj.write_uid_by_nickname_and_fuzzy(path_read_txt,path_write_excel,path_write_txt)
#_______________________________________________________________________________________________________________________
#@ UID —— 用户信息
def main_write_user_info_by_uid():
    #! 修改值（路径）
    path_read_txt       = DESKTOP + 'aa' + TXT      # UID
    path_write_excel    = DESKTOP + 'bb' + XLSX     # 用户信息
    #// 爬虫
    obj = wwd.WEIBO_WRITE_DATA()
    obj.write_user_info_by_uid(path_read_txt,path_write_excel)
#_______________________________________________________________________________________________________________________
#@ UID —— MID
def main_write_mid_by_uid_and_time():
    #! 修改值（路径）
    path_read_txt       = DESKTOP + 'aa' + TXT      # UID
    path_write_excel    = DESKTOP + 'bb' + XLSX     # MID
    #! 修改值（时间）
    time1 = '2021-08-09 16:00:00'
    time2 = '2021-08-09 17:00:00'
    #// 转为时间戳
    start_time  = time.mktime(time.strptime(time1,"%Y-%m-%d %H:%M:%S"))
    end_time    = time.mktime(time.strptime(time2,"%Y-%m-%d %H:%M:%S"))
    #// 爬虫
    obj = wwd.WEIBO_WRITE_DATA()
    obj.write_mid_by_uid_and_time(path_read_txt,path_write_excel,start_time,end_time)
#_______________________________________________________________________________________________________________________
#@ MID —— 转发信息
def main_write_repost_info_by_mid():
    #! 修改值（路径）
    path_read_txt       = DESKTOP + 'aa' + TXT      # MID
    path_write_excel    = DESKTOP + 'bb' + XLSX     # 转发信息
    #// 爬虫
    obj = wwd.WEIBO_WRITE_DATA()
    obj.write_repost_info_by_mid(path_read_txt,path_write_excel)





#_______________________________________________________________________________________________________________________
#@ 入口
# main_console_uid_by_nickname_and_exact()
# main_write_uid_by_nickname_and_exact()
# main_write_uid_by_nickname_and_fuzzy()
# main_write_user_info_by_uid()
# main_write_mid_by_uid_and_time()
# main_write_repost_info_by_mid()